package com.suixinsanren.design.proxy.demo.demo02;

public class DuckProxy implements Bird {

    private Duck duck;

    private int quackCount = 0;
    private int flyCount = 0;

    public DuckProxy() {
        this.duck = new Duck();
    }

    @Override
    public void quack() {
        duck.quack();
        quackCount++;
    }

    @Override
    public void fly() {
        duck.fly();
        flyCount++;
    }

    public void getCountInfo() {
        System.out.println("叫" + quackCount + "次");
        System.out.println("飞" + flyCount + "次");
    }
}
